package cn.lili.controller.promotion;

import cn.lili.common.utils.ResultUtil;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.promotion.entity.dos.GreenConfig;
import cn.lili.modules.promotion.service.GreenConfigService;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

/**
 * @author xiangqian
 * @version 1.0
 * @data 2023/12/18 14:24
 *
 * 绿色积分池-功能配置
 */
@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/promotion/green/config")
public class GreenConfigController {

    private final GreenConfigService greenConfigService;

    @ApiModelProperty("新增/修改功能配置")
    @PostMapping
    public ResultMessage<Boolean> saveOrUpdate(@RequestBody GreenConfig greenConfig) {
        return ResultUtil.data(greenConfigService.saveOrUpdate(greenConfig));
    }

    @ApiModelProperty("查询最新功能配置")
    @GetMapping("/getNewConfig")
    public ResultMessage<GreenConfig> getNewConfig() {
        return ResultUtil.data(greenConfigService.getNewConfig());
    }
}
